//------奖金测算 机构测算 机构测算配置--//------
import request from "@/router/axios";

//同步
export function asynOrgTree(query){
  return request({
    url: '/bonus/bonusdept/syncDept',
    method: 'get',
    params: query
  })
}

export function getOrgOfDept(query){
  return request({
    url: '/bonus/bonusdept/tree',
    method: 'get',
    params: query
  })
}

//新增
export function addObj(obj) {
  return request({
    url: '/bonus/bonusdept',
    method: 'post',
    data: obj
  })
}

//编辑
export function putObj(obj) {
  return request({
    url: '/bonus/bonusdept',
    method: 'put',
    data: obj
  })
}

//获取机构编码
export function getSubDeptCode(query) {
  return request({
    url: '/bonus/bonusdept/getSubDeptCode',
    method: 'get',
    params: query
  })
}

//获取机构详情
export function getDeptInfoById(id) {
  return request({
    url: '/bonus/bonusdept/' + id,
    method: 'get'
  })
}

export function deptDelBatch(ids) {
  return request({
    url: '/bonus/bonusdept/deleteBatch',
    method: 'get',
    params: ids
  })
}


//----------关于虚拟分组----------
//新增虚拟分组
export function addGroupObj(obj) {
  return request({
    url: '/bonus/bonusfictitiousgroup',
    method: 'post',
    data: obj
  })
}

//编辑虚拟分组
export function putGroupObj(obj) {
  return request({
    url: '/bonus/bonusfictitiousgroup',
    method: 'put',
    data: obj
  })
}

//虚拟分组列表
export function getGroupList(query){
  return request({
    url: '/bonus/bonusfictitiousgroup/list',
    method: 'get',
    params: query
  })
}

//虚拟分组删除
export function groupDeleteBatch(ids) {
  return request({
    url: '/bonus/bonusfictitiousgroup/deleteBatch',
    method: 'get',
    params: ids
  })
}

//虚拟分组通过id获取相关联人员
export function getUserOfGroupById(query){
  return request({
    url: '/bonus/bonusfictitiousgroupperson/page',
    method: 'get',
    params: query
  })
}

//虚拟分组-添加人员
export function addUserOfGroup(obj) {
  return request({
    url: '/bonus/bonusfictitiousgroupperson/savelist',
    method: 'post',
    data: obj
  })
}

//虚拟分组-删除人员
export function userDeleteBatch(ids) {
  return request({
    url: '/bonus/bonusfictitiousgroupperson/deleteBatch',
    method: 'get',
    params: ids
  })
}

//虚拟分组批量修改系数
//获取系数
export function getPostRatioByDept(groupId) {
  return request({
    url: '/bonus/bonusfictitiousgroupperson/getPostRatioByDept/' + groupId,
    method: 'get'
  })
}
//修改系数
export function updatePostRatioByDept(obj) {
  return request({
    url: '/bonus/bonusfictitiousgroupperson/updatePostRatioByDept',
    method: 'put',
    data: obj
  })

}

export function exportExcel(query) {
  return request({
    url: '/bonus/bonusdept/export',
    method: 'post',
    data: query,
    responseType: 'blob'
  })
}
